﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using EkejiWeb.Model;
using EkejiWeb.BLL;

namespace EkejiWeb.Web.Admin.AdminUser
{
    public partial class Add : System.Web.UI.Page
    {
        AdminModel model = new AdminModel();
        AdminBLL bll = new AdminBLL();
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!Page.IsPostBack)
            {

            }
        }

        protected void rightsub_Click(object sender, EventArgs e)
        {
            model.UserName = user.Text.Trim();
            model.PassWord = password.Text.Trim();
            model.Type = tbType.SelectedItem.Text.Trim();
            model.IdCard = id.Text.Trim();
            model.QQ = QQ.Text.Trim();
            model.Tel = Tel.Text.Trim();
            model.Adress = address.Text.Trim();
            Boolean a = bll.AddAdmin(model);
            if (a)
            {
                Response.Write("<Script Language=JavaScript>alert('注册成功！');</Script>");
                return;
            }
            else
            {
                Response.Write("<Script Language=JavaScript>alert('注册失败！');</Script>");
                return;
            }
        }

        protected void leftsub_Click(object sender, EventArgs e)
        {
            user.Text="";
            password.Text="";
            password2.Text = "";
            id.Text="";
            QQ.Text="";
            Tel.Text="";
            address.Text="";
        }
    }
}